<%@page import="service.Constan"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" href="css/validationEngine.jquery.css"
	type="text/css" />
<link rel="stylesheet" href="css/template.css" type="text/css" />
<script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine-vi.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
<script type="text/javascript">
	function validateForm() {
		var name = document.forms["form"]["name"].value;
		var username = document.forms["form"]["username"].value;
		var email = document.forms["form"]["email"].value;
		if (name == "") {
			alert("Name khong duoc de trong");
			return false;
		}
		if (username == "") {
			alert("Username khong duoc de trong");
			return false;
		}
		if (email == "") {
			alert("Email khong duoc de trong");
			return false;
		}
		console.log(email);
		console.log(testmail);
		if (!validateEmail(email)) {
			alert("Email khong dung dinh dang");
			return false;
		}
		return true;
	}
	function validateEmail(email) {
		var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
		return (reg.test(email));
	}
</script>
</head>
<body>
	<%@ include file="Menu.jsp"%>
	<div class="panel panel-default">
		<!-- Default panel contents -->
		<div class="panel-heading">Add new Employee</div>
		<br>
		<form class="form-horizontal" action="doaddEmployee" method="post"
			id="id" name="form" onsubmit="return validateForm()">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Name</label>
				<div class="col-sm-10">
					<input type="text" name="name" value="" placeholder="Enter your name:" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputPassword3" class="col-sm-2 control-label">Username</label>
				<div class="col-sm-10">
					<input type="text" name="username" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
				<div class="col-sm-10">
					<input type="text" name="email" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="submit" name="add" value="Add" />
				</div>
			</div>
		</form>
	</div>
</body>
</html>